<%@ page language="java" %>

<%@ page import="com.scalar.chiptrack.commons.SessionKeys,
                 com.scalar.chiptrack.utils.ConfigManager,
				 com.scalar.chiptrack.commons.Constants,
				 com.scalar.chiptrack.users.Functionality,
				 com.scalar.chiptrack.users.User"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<chiptrack:checkLogon sourcePage="/sortRelease.do" />
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<HTML>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet"></HEAD>
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/assembly_release.js"></script>

<SCRIPT language="JavaScript">

function cancel()
{
    window.location="sortRelease.do"
}

function reset()
{
    document.sortReleaseForm.reset();
}

function sendMail( assmReleaseId )
{
    newWindow = window.open ('<%=chipTracContext%>/sendAssmMail.do?type=Sort&assmReleaseId=' + assmReleaseId,'sendMailPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=800,height=550,resizable=yes');
    newWindow.focus();
}

function printView( sortRelId )
{
	newWindow = window.open ('<%=chipTracContext%>/sortRelease.do?action=printerFriendly&sortRelId='+sortRelId,'printerFreindlyPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=800,height=550,resizable=yes');
}

function openAuditTrail( releaseId, releaseNumber )
{
    newWindow=window.open('<%=chipTracContext%>/releaseAuditTrail.do?action=auditTrail&releaseId='+releaseId+'&releaseNumber='+releaseNumber+'&type=<%=Constants.LOCATION_TYPE_SORT%>','releaseAuditTrailPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=600,height=700,left=100,top=50,resizable=yes');
    newWindow.moveTo(100,50);
    newWindow.focus();
}

</SCRIPT>

<BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0">

<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
	<TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

	<!-- Side Navigation start -->
	<%@ include file="/jsp/operations/releaseMenu.jsp" %></TD>
	<!-- end of the side navigations -->

	<TD bgcolor="#ffffff">
	<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
	<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
	<TD valign="top" width="100%">

	<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
	<BR>

	<html:form action="/sortRelease" enctype="multipart/form-data"  method="POST">
    <nested:nest property="sortRelease" >
		<TABLE width="90%" align="right" cellpadding="2" cellspacing="2" border="0">
			<TR>
                <TD colspan="4" class="NArialW" align="center">&nbsp;&nbsp;&nbsp;Wafer Sort Release</TD>
            </TR>
            <TR>
                <TD colspan='2' align="right"  class="NArialS">
                    <A href="javascript:printView('<nested:write property="sortRelId"/>');"onMouseOver="window.status='Click for Printer Friendly Version';return true" onMouseOut="window.status='';return true"><B>[Printer-Friendly]</B></A>
                </TD>
                <TD colspan='4' align="left"  class="NArialS">
                    <A href="javascript:sendMail('<nested:write property="sortRelId"/>');"onMouseOver="window.status='Click to Email This Sort Release';return true" onMouseOut="window.status='';return true"><B>[E-mail this Sort Release]</B></A>
                </TD>
            </TR>
			<TR><TD colspan='4' align="left" class='NArialL'>&nbsp;<FONT id="errors" color='FF0000'></font></TD></TR>
			<TR><TD colspan='4' class="NArialL"><chiptrack:errors styleClass="NArialL"/></TD></TR>
			<TR><TD colspan='4' class="NArialL"><chiptrack:info styleClass="NArialL"/></TD></TR>
			<TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
			<tr>
			<td class="NArialL" width="15%">
				Sort Release #:
			</td>
			<td class="NArialL" width="30%">
                <nested:write property="sortRelNumber" />
			</td>
			<td class="NArialL" width="20%">
				Date:
			</td>
			<td class="NArialL" width="35%">
                <nested:write property="sortRelDate" />
			</td>
			</tr>
			<tr>
			<td class="NArialL" width="15%">
				Part Number:
			</td>
			<td class="NArialL" width="30%">
                <nested:write property="partNumber" />
			</td>
			<td class="NArialL" width="20%">
                PO #:
			</td>
            <td class="NArialL" width="35%">
                <nested:write property="sortRelPO" />
			</td>
            </tr>

			<!-- BR, Jun 23 2005 -->
            <nested:iterate property="contactPersonsList" id="contactPerson" indexId="itIndex" >
                <tr>
                <td class="NArialL" width="20%">
                    Contact Person<%=itIndex.intValue()+1%>:
                </td>
                <td class="NArialL" width="25%">
                    <nested:write property="name" />
                </td>
                <td class="NArialL" width="20%">
                    Contact Person Email<%=itIndex.intValue()+1%>:
                </td>
                <td class="NArialL" width="25%">
                    <nested:write property="email" />
                </td>
                </tr>
            </nested:iterate>
            			
			
			<TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
            <tr>
            <td class="NArialL" width="15%">
                Vendor Name:
			</td>
            <td class="NArialL" width="30%">
                <nested:write property="vendName" />
			</td>
            <td class="NArialL" width="20%">
                Sort Revision:
			</td>
            <td class="NArialL" width="35%">
			    <nested:write property="sortRevision" />
			</td>
			</tr>
            <tr>
            <td class="NArialL" width="15%">
                Vendor Contact Person:
			</td>
            <td class="NArialL" width="30%">
                <nested:write property="vendContactPerson" />
			</td>
            <td class="NArialL" width="20%">
                Vendor Contact Person Email:
			</td>
            <td class="NArialL" width="35%">
                <nested:write property="vendContactPersonEmail" />
			</td>
			</tr>
            <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
           <%-- <TR><TD colspan='4' class="NArialL">Lot Information </TD></TR>--%>
            <TR>
                <TD colspan='4' class="NArialL">
                    <table width="90%" align="left" cellpadding="2" cellspacing="2" border="0">
                        <nested:iterate property="sortReleaseLotList" type="com.scalar.chiptrac.operations.release.SortReleaseLot">
                            <tr>
                               <td colspan="5" class="NArialL" align="left">Wafer Information for Lot Number : <nested:write property="lotNumber"/></td>
                            </tr>
                        </nested:iterate>
                        <tr>
                            <td colspan="5" class="NArialL" nowrap>
                               <nested:iterate property="sortReleaseLotList" type="com.scalar.chiptrac.operations.release.SortReleaseLot">
                                    <%int i=0; %>
                                    <table width="90%" align="center" cellpadding="2" cellspacing="2" border="0">
                                    <nested:iterate property="waferList" type="com.scalar.chiptrac.operations.release.SortReleaseWafer" indexId="iteratIdx">
                                        <%if(i%5 == 0 ){%><TR><%}%>
                                        <TD  class="NArialL">
                                        <nested:checkbox property="selected" styleClass="txfield" disabled="true"/>&nbsp;
                                        Wafer-<nested:write property="waferId"/>&nbsp;&nbsp;&nbsp;
                                        </TD>
                                        <%i++;%>
                                    </nested:iterate>
                                    </table>
                               </nested:iterate>
                            </td>
                        </tr>
                    </table>
                </TD>
            </TR>
            <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
            <tr>
            <td class="NArialL" width="15%">
                Special Instructions:
			</td>
            <td class="NArialL" width="30%">
			    <nested:textarea property="specialInstr" styleClass="txfield" cols="35" rows="5" disabled="true" />
			</td>
            <td class="NArialL" colspan='2' width="20%"></td>
			</tr>
            <tr>
            <td class="NArialL" width="15%">
                Shipping requirements:
			</td>
            <td class="NArialL" width="30%">
                <nested:write property="shipmentReq" />
			</td>
            
            <td class="NArialL" width="20%" colspan="2"></td>
			
			</tr>
			
			<tr><td colspan=2><br></td></tr>
			
			<nested:nest property="specificationFileSetupForm" >
            <tr>
            <td class="NArialL" width="15%">
                Sort Specification:
			</td>
            <td class="NArialL" width="30%">
                <nested:write property="specifincationFileName" />
			</td>
            <td class="NArialL" width="20%">
                Test Spec Rev:
			</td>
            <td class="NArialL" width="35%">
                <nested:write property="revisionNumber" />
			</td>
			</tr>
			
			<!-- BR, Jun 23, 2005 --- Test Spec Information -- START ----- -->
			
			<tr>
            <td class="NArialL" width="15%">
                Test Program:
			</td>
            <td class="NArialL" width="30%">
                <nested:write property="testProgramName" />
			</td>
            <td class="NArialL" width="20%">
                Test Program Revision:
			</td>
            <td class="NArialL" width="35%">
                <nested:write property="testProgramRevision" />
			</td>
			</tr>
            <tr>
            <td class="NArialL" width="15%">
                Test Flow:
			</td>
            
            <td class="NArialL" colspan="3">
                <nested:write name="sortRelease" property="testFlow" />
			</td>
			</tr>

			</nested:nest>

			<tr>
            <td class="NArialL" width="15%">
                Freight Carrier:
			</td>

            <td class="NArialL" colspan="3">
                <nested:write name="sortRelease" property="shipperName" />
			</td>
			</tr>
			<tr><td colspan=2><br></td></tr>
			
			<!-- BR, Jun 23, 2005 --- Test Spec Information -- END ----- -->
						
            <tr>
				<td class="NArialL" colspan='4'>
					Shipping Address:
				</td>
			</tr>
			<tr>
				<td class="NArialL">
					Contact Person:
				</td>
				<td class="NArialL">
					<nested:write property="shiptoAddress.contactPerson"/>
				</td>
				<td class="NArialL">
					Email:
				</td>
				<td class="NArialL">
					<nested:write property="shiptoAddress.email"/>
				</td>
			</tr>

			<tr>
				<td class="NArialL">
					Phone:
				</td>
				<td class="NArialL">
					<nested:write property="shiptoAddress.phoneNumber"/>
				</td>
				<td class="NArialL">
					Fax:
				</td>
				<td class="NArialL">
					<nested:write property="shiptoAddress.faxNumber"/>
				</td>
			</tr>
			<tr>
				<td class="NArialL">
					Address1:
				</td>
				<td class="NArialL">
					<nested:write property="shiptoAddress.address1"/>
				</td>
				<td class="NArialL">
					Address2:
				</td>
				<td class="NArialL">
					<nested:write property="shiptoAddress.address2"/>
				</td>
			</tr>
			<tr>
				<td class="NArialL">
					Address3:
				</td>
				<td class="NArialL">
					<nested:write property="shiptoAddress.address3"/>
				</td>
				<td class="NArialL">
					Address4:
				</td>
				<td class="NArialL">
					<nested:write property="shiptoAddress.address4"/>
				</td>
			</tr>
			<tr>
				<td class="NArialL">
					City:
				</td>
				<td class="NArialL">
					<nested:write property="shiptoAddress.city"/>
				</td>
				<td class="NArialL">
					State:
				</td>
				<td class="NArialL">
					<nested:write property="shiptoAddress.state"/>
				</td>
			</tr>
			<tr>
				<td class="NArialL">
					Country:
				</td>
				<td class="NArialL">
					<nested:write property="shiptoAddress.country"/>
				</td>
				<td class="NArialL">
					Zip:
				</td>
				<td class="NArialL">
					<nested:write property="shiptoAddress.zipCode"/>
				</td>
			</tr>
            <nested:greaterThan value="0" property="sortRelId">
                <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='5'></TD></TR>
                <TR><TD colspan='4' class="NArialL">
                    Please Click here for <a href="javascript:openAuditTrail('<nested:write property="sortRelId"/>','<nested:write property="sortRelNumber"/>')">Audit Trails</a>
                    </TD>
                </TR>
            </nested:greaterThan>
            <tr><td colspan="4" align="center">&nbsp;</td></tr>
			<tr>
				<td colspan="4" align="center">
                    <a href="<%=chipTracContext%>/sortRelease.do"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/cancel.gif" width="53" height="17" onmouseover="window.status='Click to go back';return true" onmouseout="window.status='';return true" title="Click here to go back"></a>
				</td>
			</tr>
            <tr><td colspan="4" align="center">&nbsp;</td></tr>
		</TABLE>
        </nested:nest>
	</html:form>
<!-- till here -->
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>

<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->

</BODY>
</HTML>